<template>
  <svg class="svg-icon" aria-hidden="true">
    <use :xlink:href="symbolId" :fill="color" />
  </svg>
</template>

<script setup>
  const props = defineProps({
    name: {
      type: String,
      required: true
    },
    prefix: {
      type: String,
      default: '#icon'
    },
    color: {
      type: String,
      default: 'currentColor'
    }
  })

  const symbolId = computed(() => `#${props.prefix}-${props.name}`)
</script>

<style scoped>
  .svg-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: currentColor;
    overflow: hidden;
  }
</style>
